;Assembler header file for OSModule
;written by DefMod (Dec 31 2005) on Sat Dec 31 14:03:53 2005
;Jonathan Coxhead, jonathan@doves.demon.co.uk, 21 Aug 1995

        [       :LNOT: :DEF: OSModule_Hdr
        GBLS    OSModule_Hdr

        [       :LNOT: :DEF: Get_Types
        GBLS    Get_Types
        ]
        [       :LNOT: :DEF: Types_Hdr
Get_Types                       SETS    "GET oslib/Types.Hdr"
        |
Get_Types                       SETS    ""
        ]
        $Get_Types

        [       :LNOT: :DEF: Get_OS
        GBLS    Get_OS
        ]
        [       :LNOT: :DEF: OS_Hdr
Get_OS                          SETS    "GET oslib/OS.Hdr"
        |
Get_OS                          SETS    ""
        ]
        $Get_OS

;Symbols for constants
OSModule_EntryStart             *       0
OSModule_EntryInit              *       4
OSModule_EntryDie               *       8
OSModule_EntryService           *       12
OSModule_EntryTitle             *       16
OSModule_EntryHelp              *       20
OSModule_EntryTable             *       24
OSModule_EntrySWIChunk          *       28
OSModule_EntrySWIEntry          *       32
OSModule_EntryNameTable         *       36
OSModule_EntryNameCode          *       40
OSModule_EntryMessageFile       *       44
OSModule_EntryFlagsOffset       *       48
OSModule_SWIChunkSize           *       64
OSModule_SWISystemBase          *       262144
OSModule_SWIApplicationBase     *       524288
OSModule_SWIUserBase            *       786432
OSModule_SectionSystem          *       &FFFFFFFF
OSModule_SectionCard0           *       &0
OSModule_SectionCard1           *       &1
OSModule_SectionCard2           *       &2
OSModule_SectionCard3           *       &3
OSModule_SectionROM1            *       &FFFFFFFE
OSModule_SectionROM2            *       &FFFFFFFD
OSModule_SectionROM3            *       &FFFFFFFC
OSModule_SectionROM4            *       &FFFFFFFB
OSModule_StatusUnplugged        *       &FFFFFFFF
OSModule_StatusDormant          *       &0
OSModule_StatusActive           *       &1
OSModule_StatusRunning          *       &2
OSModule_InfoFSCommand          *       &80
OSModule_InfoConfiguration      *       &40
OSModule_InfoHelp               *       &20
OSModule_InfoLookupStrings      *       &10
OSModule_32BitCompatible        *       &1
Error_ModuleNotMod              *       &100
Error_ModuleMHNoRoom            *       &101
Error_ModuleRMNotFound          *       &102
Error_ModuleCantKill            *       &103
Error_ModuleCantKill2           *       &103
Error_ModuleWimpCantKill        *       &104
Error_ModuleBadModuleReason     *       &105
Error_ModuleBadDynamicArea      *       &105
Error_ModuleRMNotFoundInROM     *       &106
Error_ModuleModulePostfix       *       &107
Error_ModuleNoMoreModules       *       &108
Error_ModuleNoMoreIncarnations  *       &109
Error_ModulePostfixNeeded       *       &109
Error_ModuleIncarnationExists   *       &10B
Error_ModuleIncarnationNotFound *       &10C
Error_ModuleChunkNotRM          *       &10D
Error_ModuleBadRMHeaderField    *       &10E
Error_ModuleModuleTooOld        *       &10F
Error_ModuleModuleBadSWI        *       &110
Error_ModuleModuleInUse         *       &111
Error_ModuleBadFilingSystemOperation *       &112
Error_ModuleFilingSystemReadOnly *       &113
Error_ModuleNotADir             *       &114

;Symbols for structure offsets and sizes
                                ^       0
                                #       Int
OSModule_SectionNo              *       @

                                ^       0
                                #       Int
OSModule_Status                 *       @

                                ^       0
                                #       Bits
OSModule_InfoFlags              *       @

                                ^       0
                                #       Bits
OSModule_Flags                  *       @


;Symbols for SWI's and SWI reason codes
XOS_Module                      *       &2001E
OS_Module                       *       &1E

OSModule_Run                    *       &0
   ;Entry
   ;  R0 = &0
   ;  R1 -> tail (String)

OSModule_Load                   *       &1
   ;Entry
   ;  R0 = &1
   ;  R1 -> tail (String)

OSModule_Enter                  *       &2
   ;Entry
   ;  R0 = &2
   ;  R1 -> module_name (String)
   ;  R2 -> args (String)

OSModule_Reinit                 *       &3
   ;Entry
   ;  R0 = &3
   ;  R1 -> tail (String)

OSModule_Kill                   *       &4
   ;Entry
   ;  R0 = &4
   ;  R1 -> module_name (String)

OSModule_Info                   *       &5
   ;Entry
   ;  R0 = &5
   ;Exit
   ;  R2 = max (Int)
   ;  R3 = free (Int)

OSModule_Alloc                  *       &6
   ;Entry
   ;  R0 = &6
   ;  R3 = size (Int)
   ;Exit
   ;  R2 = blk (pointer to Void)

OSModule_Free                   *       &7
   ;Entry
   ;  R0 = &7
   ;  R2 = blk (pointer to Void)

OSModule_Tidy                   *       &8
   ;Entry
   ;  R0 = &8

OSModule_Clear                  *       &9
   ;Entry
   ;  R0 = &9

OSModule_AddArea                *       &A
   ;Entry
   ;  R0 = &A
   ;  R1 -> module (data)

OSModule_CopyArea               *       &B
   ;Entry
   ;  R0 = &B
   ;  R1 -> module (data)
   ;  R2 = size (Int)

OSModule_Enumerate              *       &C
   ;Entry
   ;  R0 = &C
   ;  R1 = module_no (Int)
   ;  R2 = instance_no (Int)
   ;Exit
   ;  R1 = module_no_out (Int)
   ;  R2 = instance_no_out (Int)
   ;  R3 -> module (data)
   ;  R4 = workspace (pointer to Void)
   ;  R5 -> postfix (String)

OSModule_Realloc                *       &D
   ;Entry
   ;  R0 = &D
   ;  R2 = blk (pointer to Void)
   ;  R3 = size_increase (Int)
   ;Exit
   ;  R2 = blk_out (pointer to Void)

OSModule_Instantiate            *       &E
   ;Entry
   ;  R0 = &E
   ;  R1 -> instance_name (String)

OSModule_Rename                 *       &F
   ;Entry
   ;  R0 = &F
   ;  R1 -> old_name (String)
   ;  R2 -> new_postfix (String)

OSModule_Prefer                 *       &10
   ;Entry
   ;  R0 = &10
   ;  R1 -> instance_name (String)

OSModule_AddPoduleArea          *       &11
   ;Entry
   ;  R0 = &11
   ;  R1 -> environment (String)
   ;  R2 = chunk (Int)
   ;  R3 = rom_section (OSModule_SectionNo)

OSModule_Lookup                 *       &12
   ;Entry
   ;  R0 = &12
   ;  R1 -> module_name (String)
   ;Exit
   ;  R1 = module_no (Int)
   ;  R2 = instance_no (Int)
   ;  R3 -> module (data)
   ;  R4 = workspace (pointer to Void)
   ;  R5 -> postfix (String)

OSModule_EnumerateROM           *       &13
   ;Entry
   ;  R0 = &13
   ;  R1 = module_no (Int)
   ;  R2 = section (OSModule_SectionNo)
   ;Exit
   ;  R1 = module_no_out (Int)
   ;  R2 = section_out (Int)
   ;  R3 -> module_name (String)
   ;  R4 = status (OSModule_Status)
   ;  R5 = chunk_no (Int)

OSModule_EnumerateROMWithInfo   *       &14
   ;Entry
   ;  R0 = &14
   ;  R1 = module_no (Int)
   ;  R2 = section (OSModule_SectionNo)
   ;Exit
   ;  R1 = module_no_out (Int)
   ;  R2 = section_out (Int)
   ;  R3 -> module_name (String)
   ;  R4 = status (OSModule_Status)
   ;  R5 = chunk_no (Int)
   ;  R6 = bcd_version (Int)

Service_UKCommand               *       &4
   ;Entry
   ;  R0 -> command (String)
   ;  R1 = &4
   ;Exit
   ;  R0 -> error (OS_Error)
   ;  R1 = unclaimed (Bool)

Service_Error                   *       &6
   ;Entry
   ;  R0 -> error (OS_Error)
   ;  R1 = &6

Service_UKByte                  *       &7
   ;Entry
   ;  R1 = &7
   ;  R2 = byte (Int)
   ;  R3 = arg0 (Int)
   ;  R4 = arg1 (Int)
   ;Exit
   ;  R1 = unclaimed (Bool)
   ;  R2 = res0 (Int)
   ;  R3 = res1 (Int)

Service_UKWord                  *       &8
   ;Entry
   ;  R1 = &8
   ;  R2 = word (Int)
   ;  R3 -> block (data)
   ;Exit
   ;  R1 = unclaimed (Bool)

Service_Help                    *       &9
   ;Entry
   ;  R0 -> command (String)
   ;  R1 = &9
   ;Exit
   ;  R1 = unclaimed (Bool)

Service_UKConfig                *       &28
   ;Entry
   ;  R0 -> tail (String)
   ;  R1 = &28
   ;Exit
   ;  R0 -> error (OS_Error)
   ;  R1 = unclaimed (Bool)

Service_UKStatus                *       &29
   ;Entry
   ;  R0 -> tail (String)
   ;  R1 = &29
   ;Exit
   ;  R1 = unclaimed (Bool)

Service_NewApplication          *       &2A
   ;Entry
   ;  R1 = &2A
   ;Exit
   ;  R1 = unclaimed (Bool)

Service_LookupFileType          *       &42
   ;Entry
   ;  R1 = &42
   ;  R2 = file_type (Bits)
   ;Exit
   ;  R1 = unclaimed (Bool)
   ;  R2 = name1 (Bits)
   ;  R3 = name2 (Bits)

Service_PostInit                *       &73
   ;Entry
   ;  R1 = &73

Service_SyntaxError             *       &8C
   ;Entry
   ;  R1 = &8C
   ;  R2 -> offset (Int)
   ;  R3 = base (pointer to data)
   ;  R4 -> command (String)
   ;Exit
   ;  R0 -> error (OS_Error)
   ;  R1 = unclaimed (Bool)

Service_ModulePostInit          *       &DA
   ;Entry
   ;  R0 -> module (data)
   ;  R1 = &DA
   ;  R2 -> title (Char)
   ;  R3 -> postfix (String)
   ;  R4 = bcd_version (Int)

Service_ModulePostFinal         *       &DB
   ;Entry
   ;  R0 -> module (data)
   ;  R1 = &DB
   ;  R2 -> title (Char)
   ;  R3 -> postfix (String)
   ;  R4 = bcd_version (Int)

        ]
        END
